import { PrimaryGeneratedColumn, Column, Entity,IsNull} from "typeorm";
import { IsDefined, IsString, IsArray, Validate, MaxLength,IsNotEmpty } from 'class-validator';

@Entity()
export class User {
  @PrimaryGeneratedColumn()
  @IsNotEmpty()
  id: number;

  @Column()
  @IsNotEmpty()
  userId: string;
  
  @Column({ nullable:true })
  type: number;

  @IsString()
  @IsDefined()
  @Column({ length: 45})
  @IsNotEmpty()

  username: string;

  @Column({ length: 45,nullable:true })
  @IsString()
  @IsDefined()
  nickname: string;

  @Column({ nullable:true })
  @IsString()
  @IsDefined()
  headThumb: string;

  @Column({ nullable:true })
  @IsDefined()
  score: number;

  @Column({ nullable:true })
  @IsDefined()
  token: string;

  @Column({ nullable:true })
  @IsNotEmpty()
  password: string;

  @Column({
    nullable: true,
    default: () => 0,
  })
  sign: number;
}